<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@ taglib prefix="f" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="/admin/res/style.css">
<link rel="stylesheet" type="text/css" href="/admin/res/index.css">
<script src="/admin/res/jquery.min.js"></script>
<script src="/skin/scripts/jquery-1.10.2.min.js"></script><!-- editor 必须使用此版本，否则不显示 -->
<script src="/admin/res/cookie.js"></script>
<script src="/admin/res/layindex.js"></script>
<script type="text/javascript" src="/skin/scripts/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" charset="utf-8" src="/editor/kindeditor-min.js"></script>
<script type="text/javascript" charset="utf-8" src="/editor/lang/zh_CN.js"></script>
 <script src="/skin/icheck/icheck.min.js"></script>
 <script type="text/javascript">
     $(function () {
    	 $('input').iCheck({
 		    checkboxClass: 'icheckbox_square-blue',
 		    radioClass: 'iradio_square-blue',
 		    increaseArea: '20%' 
 		  });
            //初始化表单验证
            $("#form1").initValidform();
            //加载编辑器 
            KindEditor.ready(function (K) {
                var editor = K.create('.editor', {
                    themeType: 'simple',
                    resizeType: 1,
                    width: '98%',
                    height: '350px',
                    filterMode: false,
                    dialogAlignType: "page",
                    uploadJson: '/skin/tools/upload_ajax.ashx?action=EditorFile&IsWater=0',
                    fileManagerJson: '/skin/tools/upload_ajax.ashx?action=ManagerFile',
                    allowFileManager: true
                });
                //这里是监听按钮点击事件 然后在初始化点击按钮弹窗上传图片的基本配置
                $(".upload-img").each(function () {
                    var t = $(this).prev().attr("id");
                    K(this).click(function () {
                        var editor = K.editor({
                            allowFileManager: true,
                            uploadJson: '/skin/tools/upload_ajax.ashx?action=EditorFile&IsWater=0',
                            fileManagerJson: '/skin/tools/upload_ajax.ashx?action=ManagerFile'
                        });
                        editor.loadPlugin('image', function () {
                            editor.plugin.imageDialog({
                                imageUrl: K("#" + t).val(),
                                clickFn: function (url, title, width, height, border, align) {
                                    K("#" + t).val(url);
                                    editor.hideDialog();
                                }
                            });
                        });
                    });
                });
            });          
      
      
        });
       
     function loaduploadimg() {
         $(".upload-img").InitUploader({ filesize: "12288", sendurl: "../skin/tools/upload_ajax.ashx", swf: "../skin/scripts/webuploader/uploader.swf", filetypes: "gif,jpg,jpeg,png,exe,bmp,rar,zip,doc,docx,pdf,xls,xlsx,txt,swf,flv,mp4,mp3" });
     }
       
</script>

</head>
<body class="mainbody">


<f:form action="/admin/category/add" method="POST" modelAttribute="node">
		<c:if test="${node.id!=null }">
			<f:hidden path="id" />			
			<input type="hidden" name="_method" value="PUT" />
		</c:if>
<div class="row">
  <div class="form-group col-md-6">
    <label>上级栏目</label>
    <div class="controls">
     <f:select class="form-control" path="pid" >
     <f:option value="0">默认站点</f:option>
     </f:select>
    </div>
  </div>
    <div class="form-group  col-md-6">
    <label>是否启用</label>
    <div class="controls">
   <label class="checkbox-inline">
 <f:checkbox path="deleted" class="form-control" checked="true" /><label>启用</label> 
</label>
    </div>
  </div>
  </div>
  <div class="row">
    <div class="form-group col-md-6">
    <label>栏目名称</label>
    <div class="controls">
     <f:input class="form-control" path="title" /> 
    </div>
  </div>
      <div class="form-group  col-md-6">
    <label>调用索引</label>
    <div class="controls">
     <f:input class="form-control normal" path="call" /> 
    </div>
  </div>
  </div>
   <div class="row">
    <div class="form-group   col-md-6">
    <label>封面图片</label>
    <div class="controls">
    <f:input  path="imgurl" class="input normal  upload-path" />
          <input class="xbtn upload-img" value="上传图片">      
    </div>
  </div>
   <div class="form-group   col-md-6">
    <label>访问路径</label>
    <div class="controls">
   <f:input  class="form-control normal" path="path" /> 
    </div>
  </div>
  </div>

     <div class="row">
   <div class="form-group col-md-6">
    <label>栏目模板</label>
    <div class="controls">
   <f:select class="form-control normal"  path="tplch.id" 
items="${Tpl }" itemLabel="Tpl.title" itemValue="id"  > </f:select>
    </div>
  </div>
   <div class="form-group col-md-6">
    <label>内容模板</label>
    <div class="controls">
   <f:select class="form-control normal" path="tplcon.id" items="${tpl2 }" itemLabel="title" itemValue="id" > </f:select>
    </div>
  </div>
  </div>
   <div class="row">
    <div class="form-group   col-md-6">
    <label>跳转方式</label>
    <div class="controls">
  <f:select path="linktype" class="form-control normal">
	<f:option selected="selected" value="0">默认</f:option>
	<f:option value="1">链接到第一个子栏目</f:option>
	<f:option value="5">链接到第一条内容</f:option>
</f:select>
    </div>
  </div>  
     <div class="form-group col-md-6">
    <label>专题专辑</label>
    <div class="controls">
   <label class="checkbox-inline">
  <form:checkboxes path="selectIds" items="${contentModel.testMap}"/>
</label>

    </div>    
  </div>
   </div>
  <div class="form-group">
  <label>详细内容</label>
   <div class="controls">
   <label class="checkbox-inline">
  <input type="checkbox" id="saveremoteimg" name="saveremoteimg"  ><label>保存远程图片</label> 
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="clearlink" name="clearlink"  ><label>清除外链</label> 
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="clearscript" name="clearscript"  checked><label>清除脚本</label> 
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="setdefaultimg" name="setdefaultimg"  checked><label>设置缩略图</label> 
</label>

    </div>    
<f:textarea path="content" class="editor" ></f:textarea>
  </div>
  
   
  
  <button type="button" class="btn btn-primary">提交保存</button>
</f:form>

</body>
</html>